<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/html">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<title>用户提现审核</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0"><!-- 确保适当的绘制和触屏缩放 -->
	<link rel="stylesheet" href="{$url_css}bootstrap.min.css" type="text/css">
	<link rel="stylesheet" href="{$url_css}admin.css" type="text/css">
	<link rel="stylesheet" href="{$url_css}viewer.min.css" type="text/css"/>

	<script type="text/javascript" src="{$url_js}jquery-2.2.0.min.js"></script>
	<script type="text/javascript" src="{$url_js}jquery-1.12.0.min.js"></script>
	<script type="text/javascript" src="{$url_js}calendar/WdatePicker.js"></script>
	<script type="text/javascript" src="{$url_js}viewer-jquery.min.js"></script>
	<style type="text/css">
		{literal}
		.page_info div {
			display: inline-block;
		}

		.page_info .p_l {
			color: #666;
			float: left;
			line-height: 69px;
			font-size: 16px;
		}

		.page_info .p_r {
			color: #337AB7;
			float: right;
		}

		{/literal}
	</style>
</head>
<body>
<div class="container" style="width: 96%">
	<form action="?do=default" method="get">
		<table class="table table-bordered table-striped" align="center">
			<tr>
				<td colspan="7">
					<h5>用户提现审核</h5>
				</td>
			</tr>
			<tr>
				<td class="form-group col-xs-2">
					<div class="input-group">
						<div class="input-group-addon">用户ID</div>
						<input type="text" class="form-control" name="s_userid" placeholder="用户ID"
						       value="{if !empty($s_data['s_userid'])}{$s_data['s_userid']}{/if}">
					</div>
				</td>
				<td class="form-group col-xs-2">
					<div class="input-group">
						<div class="input-group-addon">状态</div>
						<select class="form-control" name="s_status">
							<option value="">全部</option>
							{foreach $status as $k => $v}
								{if $s_data['s_status'] == $k}
									<option value="{$k}" selected>{$v}</option>
								{else}
									<option value="{$k}">{$v}</option>
								{/if}
							{/foreach}
						</select>
					</div>
				</td>
				<td class="form-inline col-xs-2">
					<div class="input-group">
						<div class="input-group-addon">创建开始时间</div>
						<input class="form-control" id="start_time" name="start_time" type="text"
						       onFocus="WdatePicker({literal}{startDate:'%y-%M-%d 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'end_time\')}'}{/literal});"
						       value="{if $s_data['s_start_time']}{$s_data['s_start_time']}{/if}" readonly="">
					</div>
				</td>
				<td class="form-inline col-xs-2">
					<div class="input-group">
						<div class="input-group-addon">创建结束时间</div>
						<input class="form-control" id="end_time" name="end_time" type="text"
						       onFocus="WdatePicker({literal}{startDate:'%y-%M-%d 23:59:59',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'start_time\')}'}{/literal});"
						       value="{if $s_data['s_end_time']}{$s_data['s_end_time']}{/if}" readonly="">
					</div>
				</td>
				<td class="form-group col-xs-2" colspan="6" align="right">
					<input type="submit" value="搜索" class="btn btn-primary"/>
					<input type="submit" name="exportExcel" value="导出" class="btn btn-primary"/>
				</td>
			</tr>
		</table>
	</form>
		<table class="table table-bordered table-striped" align="center">
			<tr>
				<td align="center" style="width: 100px">用户ID</td>
				<td align="center" style="width: 100px">用户昵称</td>
				<td align="center" style="width: 100px">提取现金数(元)</td>
				<td align="center" style="width: 150px">创建时间</td>
				<td align="center" style="width: 150px">审核时间</td>
				<td align="center" style="width: 150px">审核状态</td>
				<td align="center" style="width: 200px">操作</td>
			</tr>
			{foreach $list as $k => $v}
				<tr>
					<td align="center">{$v['UserId']}</td>
					<td align="center">{$user[$v['UserId']]}</td>
					<td align="center">{$v['Num']}</td>
					<td align="center">{$v['CreateTime']}</td>
					<td align="center" id="it{$v.CashLogId}">{$v['UpdateTime']}</td>
					<td align="center" id="is{$v.CashLogId}" {if {$v['Status']} == 2}style="color: #88be14;"
					    {elseif {$v['Status']} == 3}style="color: red"
					    {else}style="color: #0000cc" {/if}>{$status[$v.Status]}
					</td>
					<td align="center" id="ip{$v.CashLogId}">
						{if {$v['Status']} == 2 || {$v['Status']} == 3 }已处理{/if}
						<button type="button" id="ia{$v.CashLogId}"
						        class="btn btn-success" {if $v['Status'] != 1} style="display: none" {/if}
						        onclick="approval({$v.CashLogId}, 1,{$v.UserId})">确认提现
						</button>
					</td>
				</tr>
			{/foreach}
		</table>
		<table class="table table-bordered table-striped" align="center">
			<tr>
				<td colspan="7" align="right">
					<div class="page_info">
						{if $page_info['count']}
							<div class="p_l">一共 {$page_info['count']} 条数据,共 {$page_info['page']} 页</div>
						{/if}
					</div>
					<div class="p_r">{$pagination}</div>
				</td>
			</tr>
		</table>
</div>

<script type="text/javascript">
	{literal}

    function approval(id, num, userid) {
        if (num == 1) {
            top.swal({
                title: "确定同意提现?",
                text: "提现通过将不能撤回!",
                type: "warning",
                showCancelButton: true,
                cancelButtonText: '取消',
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "确定",
                closeOnConfirm: false
            }, function () {
                $.ajax({
                    url: 'goldAuditor.php?do=approval',
                    type: 'post',
                    data: {'id': id, 'userid': userid},
                    dataType: 'json',
                    success: function (re) {
                        if (re.type == 'yes') {
                            $('#ia' + id).hide();
                            $('#ip' + id).html('已处理');
                            $('#is' + id).html('提现完成').css('color', '#88be14');
                            $('#it' + id).html(re.date);
                            setTimeout(function () {
                                top.swal("提现通过", "操作成功", "success")
                            }, 100);
                        } else {
                            top.swal("提现失败", "操作失败", "error");
                            location.reload();
                        }
                    }
                });
            });
        }
    }
	{/literal}
</script>

</body>
</html>